package com.liming.common.interceptors;

import com.liming.common.constant.SystemConstants;
import com.liming.common.util.ThreadLocalUtils;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;

/**
 * @author liming
 * @date 2025/1/13
 */
@Slf4j
public class FeignRequestInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        String id = ThreadLocalUtils.get(SystemConstants.ID);
        log.info("feign请求拦截器 --- 运作 --- ID:{}", id);
        requestTemplate.header(SystemConstants.ID, id);
    }
}
